﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Domain;
using Persistence;
using Common;
using Persistence.Dao;
namespace web
{
    public partial class newsDetail : System.Web.UI.Page
    {
        int typeid = DNTRequest.GetQueryInt("typeid", 0);
        int id = DNTRequest.GetQueryInt("id", 0);
        protected News detail = new News();
        protected void Page_Load(object sender, EventArgs e)
        {
            BindTitle();
            if (id > 0)
            {
                detail = Singleton<NewsDao>.Instance.GetModel(id);
            }
            else
            {
                IList<News> list = Singleton<NewsDao>.Instance.GetModels(" * ", "newstype=" + typeid, "newsid desc", 1, 1);
                if (list != null && list.Count > 0)
                    detail = list[0];
            }
        }
        private void BindTitle()
        {
            titleRepeater.DataSource = Singleton<NewsDao>.Instance.GetModels("top 10 *", "newstype=" + typeid, "newsid desc", 10, 1);
            titleRepeater.DataBind();
        }
    }
}
